package com.dingyx.ps.util;

import lombok.Getter;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 结算单状态枚举类型
 * 结算单状态（0:待申请，1:审核中，2:已驳回，3:待结算，4:已到账，5:已取消, 6:已结算, 7:已开票, 8:结算中）',
 */
@Getter
public enum AccountBillStatusEnum {
    toBeApplication("待申请", 0),
    examining("审核中", 1),
    rejected("已驳回", 2),
    toBeSettled("待结算", 3),
    received("已到账", 4),
    canceled("已取消", 5),
    beSettling("结算中", 8),
    hasBeSettled("已结算", 6),
    invoiced("已开票", 7),
    waitCollection("待收款确认", 9),
    ;

    // 成员变量
    private String name;
    private Integer index;
    // 构造方法
    AccountBillStatusEnum(String name, Integer index) {
        this.name = name;
        this.index = index;
    }

    /**
     * 已结算状态
     * @return
     */
    public static List<Integer> settledStatus(){
        return Arrays.asList(received, hasBeSettled, invoiced).
                stream().
                map( i -> i.index).collect(Collectors.toList());
    }

    /**
     * 未结算状态集合
     * @return
     */
    public static List<Integer> noSettledStatus(){
        return Arrays.asList(toBeSettled).
                stream().
                map( i -> i.index).collect(Collectors.toList());
    }
}
